﻿<!--_meta 作为公共模版分离出去-->
<?php $this->load->view('public/meta.html');?>
<!--/meta 作为公共模版分离出去-->

</head>
<body>
<!--_header 作为公共模版分离出去-->
<?php $this->load->view('public/header.html');?>
<!--/_header 作为公共模版分离出去-->

<!--_menu 作为公共模版分离出去-->
<?php $this->load->view('public/menu.html');?>
<!--/_menu 作为公共模版分离出去-->

<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 会员管理 <span class="c-gray en">&gt;</span> 会员列表<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="Hui-article">
		<article class="cl pd-20">
			<div class="text-c">
				<form action="http://www.baidu.com">
					<input type="text" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱" id="" name="">
					<button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
				</form>
			</div>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
			 <!--<span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="javascript:;" onclick="member_add('添加用户','member-add.html','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加用户</a></span>--> 
			 <span class="r">共有数据：<strong><?php echo $nums;?></strong> 条</span> </div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-hover table-bg table-sort">
					<thead>
						<tr class="text-c">
							<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
							<th width="80">用户编号ID</th>
							<th width="100">手机号</th>
							<th width="130">用户注册时间</th>
							<th width="130">用户状态</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>

						<?php foreach($users as $k=>$v):?>
						<tr class="text-c">
							<!-- <td><input type="checkbox" value="<?php echo $v['user_id'];?>" name="user_id[]"></td> -->
							<td><?php echo $v['user_id'];?></td>
							<td><?php echo $v['user_phone'];?></td>
							<td><?php echo date("Y-m-d H:i:s",$v['reg_time']);?></td>
							<td class="td-status">
								<?php if($v['status']==1):?>
								<span class="label label-success radius">启用</span>
								<?php else:?>
								<span class="label radius">停用</span>
								<?php endif;?>
							</td>
							
							
							<td class="td-manage">
								<?php if($v['status']==1):?>
								<a style="text-decoration:none" data-id="<?php echo $v['user_id'];?>" data-staus="0" class="btnstatus" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a>
								<?php else:?>
								<a style="text-decoration:none" data-id="<?php echo $v['user_id'];?>" data-staus="1" class="btnstatus" href="javascript:;" title="启用"><i class="Hui-iconfont">&#xe6e1;</i></a>
								<?php endif;?>
								
								
								<a title="删除" href="javascript:;" data-id="<?php echo $v['user_id'];?>"  class="ml-5 deluser" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
					<?php endforeach;?>
					</tbody>
				</table>
			</div>
		</article>
	</div>
</section>

<!--_footer 作为公共模版分离出去-->
<?php $this->load->view('public/footer.html');?>
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<?php echo base_url(),ADMIN_DIR?>/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="<?php echo base_url(),ADMIN_DIR?>/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo base_url(),ADMIN_DIR?>/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$(function(){
	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,4,4]}// 制定列不参与排序
		]
	});
	$('.table-sort tbody').on( 'click', 'tr', function () {
		if ( $(this).hasClass('selected') ) {
			$(this).removeClass('selected');
		}
		else {
			table.$('tr.selected').removeClass('selected');
			$(this).addClass('selected');
		}
	});

	$(".btnstatus").on('click',function(){

		var title = $(this).attr('title');
		//layer.confirm('确认要'+title+'吗？',function(index){
				
				$.ajax({
				  url: "<?php echo base_url(),'admin/member/changestatus';?>",
				  type: "get",
				  'data':{
						'user_id':$(this).attr('data-id'),
						'status':$(this).attr('data-staus')
						
					},
				beforeSend : function (jqXHR, settings) {
						 
					},
				  success: function(response, status, xhr){
				  		console.log(response);
						var info = $.parseJSON(response);
						if(info.stat==1){
							
							//layer.msg(info.message,{icon: 6,time:1000});
							location.href=info.url;
						}else{
							
							//layer.msg(info.message,{icon: 6,time:1000});
							location.href=info.url;
						}
				  
				  }
			});
		//});
	});



});
/*用户-添加*/
function member_add(title,url,w,h){
	layer_show(title,url,w,h);
}
/*用户-查看*/
function member_show(title,url,id,w,h){
	layer_show(title,url,w,h);
}

/*用户-编辑*/
function member_edit(title,url,id,w,h){
	layer_show(title,url,w,h);
}
/*密码-修改*/
function change_password(title,url,id,w,h){
	layer_show(title,url,w,h);	
}
/*用户-删除*/
$(".deluser").on('click',function(){

		if(!confirm('你确定删除吗')){
			return false;
		}
		
		//layer.confirm('确认要'+title+'吗？',function(index){
				
				$.ajax({
				  url: "<?php echo base_url(),'admin/member/del';?>",
				  type: "get",
				  'data':{
						'user_id':$(this).attr('data-id')
						
						
					},
				beforeSend : function (jqXHR, settings) {
						 
					},
				  success: function(response, status, xhr){
				  		console.log(response);
						var info = $.parseJSON(response);
						if(info.stat==1){
							
							//layer.msg(info.message,{icon: 6,time:1000});
							location.href=info.url;
						}else{
							
							//layer.msg(info.message,{icon: 6,time:1000});
							location.href=info.url;
						}
				  
				  }
			});
		//});
	});


</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>